package offer_test_20;

import java.util.Arrays;

//打印N位数，eg，输入3，则打印1~999
public class twelve_PrintNum {
	public static void main(String[] args) {
		int[] num = { 0, 0 };
		printNumOne(num, 0);
		// printSuccess(num);
	}

	public static void printNumOne(int[] num, int k) {
		for (int i = 0; i < 10; i++) {
			num[k] = i;
			if (k + 1 < num.length)
				printNumOne(num, k + 1);
			if (k == num.length - 1) {
				printSuccess(num);

			}
			// System.out.println(Arrays.toString(num));
		}
	}

	public static void printSuccess(int[] array) {
		boolean tag = false;
		for (int i = 0; i < array.length; i++) {
			if (!tag && array[i] != 0)
				tag = true;
			if (tag)
				System.out.print(array[i]);
		}
		System.out.println();
	}
}
